﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Ue.Extensions;

namespace Ue.Tests.Extensions
{
    /// <summary>
    /// DateExtensions 的摘要说明
    /// </summary>
    [TestClass]
    public class DateExtensionTests
    {
        #region GetMonthLastDay and GetMonthFirstDay

        [TestMethod]
        public void GetMonthLastDay()
        {
            Assert.AreEqual(new DateTime(2011, 1, 31), new DateTime(2011, 1, 1).GetMonthLastDay());

            Assert.AreEqual(new DateTime(2011, 2, 28), new DateTime(2011, 2, 1).GetMonthLastDay());

            Assert.AreEqual(new DateTime(2011, 4, 30), new DateTime(2011, 4, 1).GetMonthLastDay());

            Assert.AreEqual(DateTime.MaxValue,DateTime.MinValue.GetMonthLastDay());
            Assert.AreEqual(DateTime.MaxValue, DateTime.MaxValue.GetMonthLastDay());
        }

        [TestMethod]
        public void GetMonthFirstDay()
        {
            Assert.AreEqual(new DateTime(2011, 1, 1), new DateTime(2011, 1, 5).GetMonthFirstDay());

            Assert.AreEqual(new DateTime(2011, 2, 1), new DateTime(2011, 2, 6).GetMonthFirstDay());

            Assert.AreEqual(new DateTime(2011, 4, 1), new DateTime(2011, 4, 23).GetMonthFirstDay());

            Assert.AreEqual(DateTime.MinValue, DateTime.MinValue.GetMonthFirstDay());
            Assert.AreEqual(DateTime.MinValue, DateTime.MaxValue.GetMonthFirstDay());
        }

        #endregion
    }
}
